package com.smalluz.ad.modules.common.exception;

import com.fasterxml.jackson.annotation.JsonProperty;

public class ApiException  extends RuntimeException  {

	private static final Integer FAIL = 1;
	private static final String  FAIL_MSG = "系统内部错误";
	
    private Integer code;

    private String message;
    
    @JsonProperty("request_id")
    private String requestId;
    
	private static final long serialVersionUID = 1009271992768472336L;
	
	public ApiException(Throwable cause){
		super(cause);
		this.code = FAIL;
		this.message = FAIL_MSG;
	}
	
	public ApiException() {
		super();
		this.code = FAIL;
		this.message = FAIL_MSG;
	}
	
	public ApiException(String message) {
		super();
		this.code = FAIL ;
		this.message = message;
	}

	public ApiException(Integer code, String message, String requestId) {
		super();
		this.code = code;
		this.message = message;
		this.requestId = requestId;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getRequestId() {
		return requestId;
	}

	public void setRequestId(String requestId) {
		this.requestId = requestId;
	}

	
	
	
}
